package com.xhwl.logistics;

import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import com.xhwl.logistics.util.IdWorker;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.annotation.PostConstruct;
import java.util.TimeZone;

@SpringBootApplication
@EnableSwagger2
@MapperScan("com.xhwl.logistics.dao.mapper.logistics")
@EnableFeignClients
@ServletComponentScan
@EnableEurekaClient
@EnableApolloConfig
public class LogisticsApplication {

    /**
     * 物流项目启动类
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication.run(LogisticsApplication.class, args);
    }

    @Bean
    public IdWorker idWorker() {
        return new IdWorker();
    }

    @PostConstruct
    void started() {
        TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
    }
}
